package com.dragon.mmochat.model.battle.record;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.dragon.mmochat.model.battle.MmochatRoundFrame;
import com.dragon.mmochat.model.battle.MmochatRoundStateAddRole;
import com.dragon.mmochat.model.battle.MmochatRoundStateChange;

//战斗录像，每回合操作数据
public class MmochatBattleRoundRecord implements
		Comparable<MmochatBattleRoundRecord> {
	private long startTick = System.currentTimeMillis();// 开始播放时间点
	private int battleId;
	private int turn;

	// 回合操作前状态改变的角色:pos->MmochatRoundStateChange
	Map<Byte, MmochatRoundStateChange> roundNewStates = new ConcurrentHashMap<Byte, MmochatRoundStateChange>();
	// 删除角色
	Map<Byte, Integer> newRoles_delRole = new ConcurrentHashMap<Byte, Integer>();
	// 增加角色
	Map<Byte, MmochatRoundStateAddRole> newRoles_addRole = new ConcurrentHashMap<Byte, MmochatRoundStateAddRole>();
	// 回合操作后状态变化的角色
	Map<Byte, MmochatRoundStateChange> newRoles_changeState = new ConcurrentHashMap<Byte, MmochatRoundStateChange>(); // 状态改变

	// 当前回合的输出
	List<MmochatRoundFrame> frames = new ArrayList<MmochatRoundFrame>();

	// 战斗是否结束
	boolean over;

	public long getStartTick() {
		return startTick;
	}

	public void setStartTick(long startTick) {
		this.startTick = startTick;
	}

	public int getBattleId() {
		return battleId;
	}

	public void setBattleId(int battleId) {
		this.battleId = battleId;
	}

	public int getTurn() {
		return turn;
	}

	public void setTurn(int turn) {
		this.turn = turn;
	}

	public Map<Byte, MmochatRoundStateChange> getRoundNewStates() {
		return roundNewStates;
	}

	public void setRoundNewStates(
			Map<Byte, MmochatRoundStateChange> roundNewStates) {
		this.roundNewStates = roundNewStates;
	}

	public Map<Byte, Integer> getNewRoles_delRole() {
		return newRoles_delRole;
	}

	public void setNewRoles_delRole(Map<Byte, Integer> newRolesDelRole) {
		newRoles_delRole = newRolesDelRole;
	}

	public Map<Byte, MmochatRoundStateAddRole> getNewRoles_addRole() {
		return newRoles_addRole;
	}

	public void setNewRoles_addRole(
			Map<Byte, MmochatRoundStateAddRole> newRolesAddRole) {
		newRoles_addRole = newRolesAddRole;
	}

	public Map<Byte, MmochatRoundStateChange> getNewRoles_changeState() {
		return newRoles_changeState;
	}

	public void setNewRoles_changeState(
			Map<Byte, MmochatRoundStateChange> newRolesChangeState) {
		newRoles_changeState = newRolesChangeState;
	}

	public List<MmochatRoundFrame> getFrames() {
		return frames;
	}

	public void setFrames(List<MmochatRoundFrame> frames) {
		this.frames = frames;
	}

	public boolean isOver() {
		return over;
	}

	public void setOver(boolean over) {
		this.over = over;
	}

	@Override
	public int compareTo(MmochatBattleRoundRecord arg0) {
		return turn - arg0.getTurn();
	}

}
